package com.wish.wishhouse_foreclosure.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wish.wishhouse_foreclosure.entity.TbHouseInfo;
import com.wish.wishhouse_foreclosure.service.ITbHouseInfoService;
import dto.houseForeclosureDto.TbHouseInfoDto;
import dto.houseForeclosureDto.TsfContractDto;

import com.wish.wishhouse_foreclosure.service.ITbHouseInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vo.ResultEntity;
import vo.TbHouseInfoVo;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhangshuxin
 * @since 2021-03-31
 */
@RestController
@RequestMapping("/tbHouseInfo/")
public class TbHouseInfoController {

    @Autowired
    private ITbHouseInfoService iTbHouseInfoService;

    /**
     * 选择房产弹出List列表带分页
     */
    @RequestMapping("searchHouseInfoList")
    public ResultEntity searchHouseInfoList(TbHouseInfoDto tbHouseInfoDto) {

        tbHouseInfoDto.setLeaseType(tbHouseInfoDto.getLeaseType());
        PageHelper.startPage(tbHouseInfoDto.getPageNum(), tbHouseInfoDto.getPageSize());
        List<TbHouseInfoVo> tbHouseInfoList = iTbHouseInfoService.searchHouseinfoList(tbHouseInfoDto);
        PageInfo<TbHouseInfoVo> pageInfo = new PageInfo<>(tbHouseInfoList);

        return ResultEntity.ok(pageInfo);
    }

}

